#ifndef __OTRACE_H__
#define __OTRACE_H__

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "UWM.h"

#ifdef _DEBUG
#define UWM_OTRACE_MSG _T("UWM_OTRACE-{85B484C0-32FA-11d4-9EF2-00201857C47B}")
DECLARE_USER_MESSAGE(UWM_OTRACE)
#endif

#ifdef _DEBUG
void _PROVIR_EXT_CLASS OutputTrace(LPCTSTR lpszFormat, ...);
#define OTRACE OutputTrace
#else
#define OTRACE /*1 ? */(void)0 /*: OutputTrace*/
#endif //_DEBUG

inline void FileTrace(LPCSTR strFile, LPCTSTR lpszFormat, ...)
{
	va_list args;
	va_start(args, lpszFormat);

	int nBuf;
	char strBuffer[4096];

	nBuf = _vsntprintf(strBuffer, 4096, lpszFormat, args);

	ASSERT(nBuf >= 0);
	if (nBuf < 0)
		return;
	
	FILE *pFile = fopen(strFile, "a+t");
	fprintf(pFile, "%s\n", strBuffer);
	fclose(pFile);
}
#define FTRACE FileTrace

#endif // __OTRACE_H__

